<?php
declare(strict_types=1);

namespace App\Console\Commands\Tasks\Activity;

use App\Exceptions\BasicException;
use App\Repositories\Activity\LaborDay2023\LaborDay2023Repository;
use App\Repositories\LogRepository;
use Illuminate\Console\Command;

class LaborDay2023OnlineTimeCommand extends Command
{
    //命令名
    protected $signature = 'task:activity:labor-day2023-online-time';

    protected $description = 'activity:labor-day2023-online-time';

    public function __construct()
    {
        parent::__construct();
    }

    public function getSignature(): string
    {
        return $this->signature;
    }

    //业务处理

    /**
     * @throws BasicException
     */
    public function handle()
    {
        $log = new LogRepository("activity-labor-day2023");
        try{
            LaborDay2023Repository::getInstance()->batchOnlineTask();
        }catch (\Exception $e){
            $log->log("commend", "online-time");
            $log->log("error", $e->getMessage());
            $log->File();
        }
    }
}